//
//  YKSearchDrugItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/11/8.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKSearchDrugItemCell.h"
#import "YKDashView.h"
#import "YKSaleModel.h"
@interface YKSearchDrugItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *drugNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *drugPackLabel;
@property (weak, nonatomic) IBOutlet UILabel *drugFactoryLabel;

@end


@implementation YKSearchDrugItemCell
@dynamic tableViewItem;

- (void)cellWillAppear {
    [super cellWillAppear];
    YKSaleModel *model = (YKSaleModel *)self.tableViewItem.model;
    self.drugNameLabel.text = [model GOODS_NAME];
    self.drugPackLabel.text = model.CPACKINGTYPE;
    self.drugFactoryLabel.text = model.CENTERPRISE;
}

- (void)cellLoadSubViews {
    [super cellLoadSubViews];
    self.drugNameLabel.tf_weight = 1;
    self.drugPackLabel.tf_weight = 1;
    self.drugFactoryLabel.tf_weight = 1;
    
    self.drugNameLabel.textAlignment = NSTextAlignmentLeft;
    self.drugPackLabel.textAlignment = NSTextAlignmentLeft;
    self.drugFactoryLabel.textAlignment = NSTextAlignmentCenter;
    
    [@[self.drugNameLabel, self.drugPackLabel, self.drugFactoryLabel] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.top.equalTo(self.contentView.mas_top).offset(11);
    }];
    
    [@[self.drugNameLabel, self.drugPackLabel, self.drugFactoryLabel] mas_alignWeightlyAlongAxis:MASAxisTypeHorizontal
                                                                                        fixedSpace:@8
                                                                                         leadingTo:self.contentView.mas_leading
                                                                                         leadSpace:13
                                                                                        trailingTo:self.contentView.mas_trailing
                                                                                         tailSpace:13];
    
    YKDashView* dashView = [[YKDashView alloc]init];
    dashView.lineWidth = .5f;
    dashView.lineColor = [UIColor tf_colorWithHexString:@"#d4d4d4"];
    dashView.dashLineLength = 3;
    [self addSubview:dashView];
    [dashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

@end
